<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>专题列表 - 社交平台</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --secondary: #7c3aed;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            text-align: center;
            flex: 1;
        }
        
        .nav-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 20px;
        }
        
        .nav-btn.primary {
            color: var(--primary);
        }
        
        /* 搜索和筛选区域 */
        .search-filter-container {
            padding: 12px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-group {
            position: relative;
            margin-bottom: 12px;
        }
        
        .search-input {
            width: 100%;
            padding: 12px 16px 12px 44px;
            border-radius: 24px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 14px;
            outline: none;
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-tertiary);
            font-size: 18px;
        }
        
        .filter-tabs {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding-bottom: 4px;
            scrollbar-width: none;
        }
        
        .filter-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .filter-tab {
            padding: 6px 14px;
            border-radius: 18px;
            font-size: 14px;
            white-space: nowrap;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .filter-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 专题列表容器 */
        .topics-container {
            padding: 16px;
        }
        
        .topics-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .topics-title {
            font-size: 16px;
            font-weight: 600;
        }
        
        .topics-count {
            color: var(--text-tertiary);
            font-size: 14px;
        }
        
        .sort-dropdown {
            background: none;
            border: none;
            color: var(--primary);
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 专题卡片通用样式 */
        .topic-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            margin-bottom: 16px;
            overflow: hidden;
            transition: transform 0.2s ease;
        }
        
        .topic-card:hover {
            transform: translateY(-2px);
        }
        
        .topic-header {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .topic-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .topic-creator {
            flex: 1;
        }
        
        .creator-name {
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 2px;
        }
        
        .topic-time {
            font-size: 12px;
            color: var(--text-tertiary);
        }
        
        .topic-menu {
            color: var(--text-tertiary);
            background: none;
            border: none;
            font-size: 16px;
        }
        
        .topic-content {
            padding: 16px;
        }
        
        .topic-title {
            font-size: 17px;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.4;
        }
        
        .topic-description {
            font-size: 15px;
            color: var(--text-secondary);
            margin-bottom: 12px;
            line-height: 1.5;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 专题类型标签 */
        .topic-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 12px;
        }
        
        .topic-tag {
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 12px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
        }
        
        /* 无图专题样式 */
        .topic-no-image .topic-content {
            padding-bottom: 0;
        }
        
        /* 单图专题样式 */
        .topic-single-image .topic-image {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 12px;
        }
        
        .topic-single-image .topic-image img {
            width: 100%;
            height: 180px;
            object-fit: cover;
        }
        
        /* 多图专题样式 */
        .topic-multi-image .topic-images {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 12px;
        }
        
        .topic-multi-image .topic-image {
            aspect-ratio: 1/1;
            overflow: hidden;
        }
        
        .topic-multi-image .topic-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 专题底部信息 */
        .topic-footer {
            padding: 0 16px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .topic-stats {
            display: flex;
            gap: 16px;
            font-size: 13px;
            color: var(--text-tertiary);
        }
        
        .topic-stat {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .topic-action {
            padding: 6px 14px;
            border-radius: 16px;
            font-size: 14px;
            font-weight: 500;
            border: 1px solid var(--primary);
            background-color: transparent;
            color: var(--primary);
        }
        
        .topic-action.joined {
            background-color: var(--primary);
            color: white;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 70px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            font-size: 11px;
            gap: 4px;
            text-decoration: none;
            flex: 1;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 22px;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 90px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 6px;
            z-index: 9999;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            border-radius: 8px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            color: var(--text-primary);
            font-size: 15px;
            margin-top: 8px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">专题列表</div>
        <button class="nav-btn primary" id="createTopicBtn">
            <i class="fas fa-plus"></i>
        </button>
    </div>
    
    <!-- 搜索和筛选区域 -->
    <div class="search-filter-container">
        <div class="search-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索专题、标签或创建者...">
        </div>
        
        <div class="filter-tabs">
            <button class="filter-tab active">全部专题</button>
            <button class="filter-tab">热门推荐</button>
            <button class="filter-tab">最新发布</button>
            <button class="filter-tab">已加入</button>
            <button class="filter-tab">生活</button>
            <button class="filter-tab">科技</button>
            <button class="filter-tab">娱乐</button>
        </div>
    </div>
    
    <!-- 专题列表 -->
    <div class="topics-container">
        <div class="topics-header">
            <div>
                <h2 class="topics-title">发现专题</h2>
                <span class="topics-count">找到 32 个专题</span>
            </div>
            <select class="sort-dropdown" id="sortDropdown">
                <option value="recommend">推荐排序</option>
                <option value="latest">最新发布</option>
                <option value="hot">热门优先</option>
                <option value="joined">参与人数</option>
            </select>
        </div>
        
        <!-- 多图专题 -->
        <div class="topic-card topic-multi-image" data-id="1">
            <div class="topic-header">
                <img src="https://picsum.photos/id/64/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">旅行摄影联盟</div>
                    <div class="topic-time">3天前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">全球最美徒步路线大赏</h3>
                <p class="topic-description">收集全球最值得一去的徒步路线，分享徒步经验、装备清单和绝美风景，欢迎所有徒步爱好者加入交流。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">徒步</span>
                    <span class="topic-tag">旅行</span>
                    <span class="topic-tag">摄影</span>
                    <span class="topic-tag">户外</span>
                </div>
                
                <div class="topic-images">
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/29/300/300" alt="专题图片1">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/30/300/300" alt="专题图片2">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/31/300/300" alt="专题图片3">
                    </div>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 1.2k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 356 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 892 图片
                    </div>
                </div>
                <button class="topic-action" data-topic="1">加入</button>
            </div>
        </div>
        
        <!-- 单图专题 -->
        <div class="topic-card topic-single-image" data-id="2">
            <div class="topic-header">
                <img src="https://picsum.photos/id/65/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">美食探索家</div>
                    <div class="topic-time">1周前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">城市隐藏美食地图</h3>
                <p class="topic-description">寻找城市里不为人知的美食小店，分享真实测评和推荐菜品，让我们一起探索舌尖上的惊喜。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">美食</span>
                    <span class="topic-tag">探店</span>
                    <span class="topic-tag">美食地图</span>
                </div>
                
                <div class="topic-image">
                    <img src="https://picsum.photos/id/42/600/300" alt="专题图片">
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 2.5k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 1.2k 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 3.7k 图片
                    </div>
                </div>
                <button class="topic-action joined" data-topic="2">已加入</button>
            </div>
        </div>
        
        <!-- 无图专题 -->
        <div class="topic-card topic-no-image" data-id="3">
            <div class="topic-header">
                <img src="https://picsum.photos/id/66/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">读书俱乐部</div>
                    <div class="topic-time">2周前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">2023年度好书推荐与分享</h3>
                <p class="topic-description">分享你今年读过的最佳书籍，写下书评和感悟，参与每月读书讨论，结识志同道合的书友。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">读书</span>
                    <span class="topic-tag">书评</span>
                    <span class="topic-tag">文学</span>
                    <span class="topic-tag">分享</span>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 3.8k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 5.2k 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-book"></i> 1.5k 书籍
                    </div>
                </div>
                <button class="topic-action joined" data-topic="3">已加入</button>
            </div>
        </div>
        
        <!-- 多图专题 -->
        <div class="topic-card topic-multi-image" data-id="4">
            <div class="topic-header">
                <img src="https://picsum.photos/id/67/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">数码科技控</div>
                    <div class="topic-time">4天前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">2023年度数码产品评测汇总</h3>
                <p class="topic-description">各类数码产品的深度评测、横向对比和购买建议，帮助大家做出更明智的消费决策。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">数码</span>
                    <span class="topic-tag">评测</span>
                    <span class="topic-tag">科技</span>
                    <span class="topic-tag">推荐</span>
                </div>
                
                <div class="topic-images">
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/96/300/300" alt="专题图片1">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/97/300/300" alt="专题图片2">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/98/300/300" alt="专题图片3">
                    </div>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 2.1k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 876 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 432 图片
                    </div>
                </div>
                <button class="topic-action" data-topic="4">加入</button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMoreBtn">加载更多专题</button>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-thumbtack nav-icon"></i>
            <span>专题</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-bell nav-icon"></i>
            <span>通知</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 提示消息 -->
    <div class="toast" id="toast"></div>
    
    <!-- 专题操作菜单 -->
    <div class="modal fade" id="topicMenuModal" tabindex="-1">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-body p-0">
                    <button class="btn w-100 text-start px-4 py-3 border-0" style="font-size: 15px;">
                        <i class="fas fa-share-alt me-2"></i> 分享专题
                    </button>
                    <button class="btn w-100 text-start px-4 py-3 border-0" style="font-size: 15px;">
                        <i class="fas fa-bookmark me-2"></i> 收藏专题
                    </button>
                    <div class="dropdown-divider m-0"></div>
                    <button class="btn w-100 text-start px-4 py-3 border-0 text-danger" style="font-size: 15px;">
                        <i class="fas fa-flag me-2"></i> 举报专题
                    </button>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const createTopicBtn = document.getElementById('createTopicBtn');
        const filterTabs = document.querySelectorAll('.filter-tab');
        const topicActions = document.querySelectorAll('.topic-action');
        const topicMenus = document.querySelectorAll('.topic-menu');
        const sortDropdown = document.getElementById('sortDropdown');
        const searchInput = document.querySelector('.search-input');
        const loadMoreBtn = document.getElementById('loadMoreBtn');
        const toast = document.getElementById('toast');
        const topicMenuModal = new bootstrap.Modal(document.getElementById('topicMenuModal'));
        
        // 显示提示消息
        function showToast(message) {
            toast.textContent = message;
            toast.classList.add('show');
            
            clearTimeout(toast.timeout);
            toast.timeout = setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
        
        // 绑定事件
        function bindEvents() {
            // 返回按钮
            backBtn.addEventListener('click', () => {
                history.back();
                showToast('返回上一页');
            });
            
            // 创建专题按钮
            createTopicBtn.addEventListener('click', () => {
                showToast('进入创建专题页面');
            });
            
            // 筛选标签切换
            filterTabs.forEach(tab => {
                tab.addEventListener('click', function() {
                    filterTabs.forEach(t => t.classList.remove('active'));
                    this.classList.add('active');
                    showToast(`已筛选: ${this.textContent}`);
                    // 实际应用中这里会触发专题列表的重新加载
                });
            });
            
            // 搜索功能
            searchInput.addEventListener('keyup', function(e) {
                if (e.key === 'Enter') {
                    const searchText = this.value.trim();
                    if (searchText) {
                        showToast(`搜索专题: ${searchText}`);
                        // 实际应用中这里会触发搜索请求
                    }
                }
            });
            
            // 排序下拉框
            sortDropdown.addEventListener('change', function() {
                const sortType = this.options[this.selectedIndex].text;
                showToast(`已按${sortType}排序`);
                // 实际应用中这里会触发排序请求
            });
            
            // 专题操作菜单
            topicMenus.forEach(menu => {
                menu.addEventListener('click', function() {
                    const topicId = this.closest('.topic-card').getAttribute('data-id');
                    topicMenuModal.show();
                    // 实际应用中这里会记录当前操作的专题ID
                });
            });
            
            // 加入/退出专题
            topicActions.forEach(button => {
                button.addEventListener('click', function() {
                    const topicId = this.getAttribute('data-topic');
                    const topicCard = this.closest('.topic-card');
                    const memberStat = topicCard.querySelector('.topic-stat:first-child');
                    const currentMembers = parseInt(memberStat.textContent.replace(/[^0-9]/g, ''));
                    
                    if (this.classList.contains('joined')) {
                        this.classList.remove('joined');
                        this.textContent = '加入';
                        // 更新成员数
                        memberStat.innerHTML = `<i class="far fa-user"></i> ${currentMembers - 1} 成员`;
                        showToast('已退出专题');
                    } else {
                        this.classList.add('joined');
                        this.textContent = '已加入';
                        // 更新成员数
                        memberStat.innerHTML = `<i class="far fa-user"></i> ${currentMembers + 1} 成员`;
                        showToast('成功加入专题');
                    }
                });
            });
            
            // 加载更多
            loadMoreBtn.addEventListener('click', function() {
                this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
                // 模拟加载延迟
                setTimeout(() => {
                    this.textContent = '加载更多专题';
                    showToast('已加载全部专题');
                }, 1500);
            });
            
            // 点击专题卡片进入详情
            document.querySelectorAll('.topic-card').forEach(card => {
                card.addEventListener('click', function(e) {
                    // 避免点击按钮时触发卡片点击事件
                    if (!e.target.closest('button')) {
                        const topicId = this.getAttribute('data-id');
                        showToast(`进入专题 #${topicId} 详情`);
                        // 实际应用中这里会跳转到专题详情页
                    }
                });
            });
        }
        
        // 初始化
        function init() {
            bindEvents();
        }
        
        // 启动
        init();
    </script>
</body>
</html>
